package com.domain.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class GetConnection {

   private static Connection connection = null;

    public static Connection setConnection() {

        try {

            Class.forName("com.mysql.jdbc.Driver");

            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/abhidb", "root", "root");

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        return connection;
    }

    public static void closeConnection() throws SQLException {

        if (connection != null) {

            connection.close();
        }
    }
}
